import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RefundOrderVO, RefundOrderForm, RefundOrderQuery } from '@/api/primary/refundOrder/types';

/**
 * 查询退款订单列表
 * @param query
 * @returns {*}
 */

export const listRefundOrder = (query?: RefundOrderQuery): AxiosPromise<RefundOrderVO[]> => {
  return request({
    url: '/primary/refundOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询退款订单详细
 * @param id
 */
export const getRefundOrder = (id: string | number): AxiosPromise<RefundOrderVO> => {
  return request({
    url: '/primary/refundOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增退款订单
 * @param data
 */
export const addRefundOrder = (data: RefundOrderForm) => {
  return request({
    url: '/primary/refundOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改退款订单
 * @param data
 */
export const updateRefundOrder = (data: RefundOrderForm) => {
  return request({
    url: '/primary/refundOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除退款订单
 * @param id
 */
export const delRefundOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/refundOrder/' + id,
    method: 'delete'
  });
};
